<?

    function calcTemps($dateDepart=false)
    {
        // Declarations
        $timestampDepart = 0;
        $timestampMaintenant = 0;
        $duree = 0;
        
        /*
        * Format de $dateDepart = tableau(jour,mois,annee,heure,minutes,seconde)
        * Indexes :
        * 0 -> jour (JJ)
        * 1 -> mois (MM)
        * 2 -> annee (AAAA)
        * 3 -> heure (HH)
        * 4 -> minutes (mm)
        * 5 -> secondes (SS)
        */
        
        $timestampDepart = mktime($dateDepart[3],$dateDepart[4],$dateDepart[5],$dateDepart[1],$dateDepart[0],$dateDepart[2]);
        $timestampMaintenant = mktime();
        
        $duree = $timestampMaintenant - $timestampDepart;
        
        return $duree;
        
    }
    
    function dureeLisibleParUnHumain($duree=false)
    {
        if(!$duree) die('error !');
        
        $jours = gardePartieEntiere($duree / (3600*24));
        $reste = $duree % (3600*24);
        $heures = gardePartieEntiere($reste / 3600);
        $reste = $reste % 3600;
        $minutes = gardePartieEntiere($reste / 60);
        $secondes = $reste % 60;
        
        //return "$jours jour(s), $heures heure(s), $minutes minute(s), $secondes seconde(s)";
        return  array($jours,$heures,$minutes,$secondes);
    }
    
    function gardePartieEntiere($nombre)
    {
        $nombreChaine = (string)$nombre;
        $tableau = explode('.',$nombreChaine);
        return $tableau[0];
    }
    
    

?>